//
//  FindLoginView.m
//  Find
//
//  Created by lanou3g on 15/11/12.
//  Copyright © 2015年 Reiko. All rights reserved.
//

#import "FindLoginView.h"

@implementation FindLoginView


- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = kFindListCellLabelTextColor;
        [self addSubviews];
    }
    return self;
}

- (void)addSubviews{
    
    
    if (kScreenWidth == 320 && kScreenHeight == 568) {
        self.buttonFont = 16;
        self.buttonBigFont = 24;
    } else if (kScreenWidth == 320 && kScreenHeight == 480) {
        self.buttonFont = 18;
        self.buttonBigFont = 28;
    } else if (kScreenWidth == 375 && kScreenHeight == 667) {
        self.buttonFont = 20;
        self.buttonBigFont = 30;
    } else {
        self.buttonFont = 22;
        self.buttonBigFont = 32;
    }
    
    
    UIImageView *bgImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, (kScreenHeight - 64)*0.2)];
    bgImageView.image = [UIImage imageNamed:@"loginBG.jpg"];
    [self addSubview:bgImageView];
    
    self.userNameTextField = [[UITextField alloc] initWithFrame:CGRectMake(kScreenWidth*0.1, CGRectGetMaxY(bgImageView.frame), kScreenWidth*0.8, (kScreenHeight - 64)*0.07)];
    self.userNameTextField.backgroundColor = [UIColor whiteColor];
    self.userNameTextField.placeholder = @"请输入用户名";
    UIImageView *userImageLeft = [[UIImageView alloc] initWithFrame:CGRectMake(CGRectGetHeight(self.userNameTextField.frame)*0.2, 0, CGRectGetHeight(self.userNameTextField.frame)*0.8, CGRectGetHeight(self.userNameTextField.frame)*0.8)];
    userImageLeft.image = [UIImage imageNamed:@"login-user"];
    self.userNameTextField.leftView = userImageLeft;
    self.userNameTextField.leftViewMode = UITextFieldViewModeAlways;
    [self addSubview:self.userNameTextField];
    
    self.passWordTextField = [[UITextField alloc] initWithFrame:CGRectMake(CGRectGetMinX(self.userNameTextField.frame), CGRectGetMaxY(self.userNameTextField.frame)+CGRectGetHeight(self.userNameTextField.frame)*0.2, CGRectGetWidth(self.userNameTextField.frame), CGRectGetHeight(self.userNameTextField.frame))];
    self.passWordTextField.backgroundColor = [UIColor whiteColor];
    self.passWordTextField.secureTextEntry = YES;
    self.passWordTextField.placeholder = @"请输入密码,至少6个字符";
    UIImageView *passwordLeft  = [[UIImageView alloc] initWithFrame:CGRectMake(CGRectGetHeight(self.passWordTextField.frame)*0.2, 0, CGRectGetHeight(self.passWordTextField.frame)*0.8, CGRectGetHeight(self.passWordTextField.frame)*0.8)];
    passwordLeft.image = [UIImage imageNamed:@"login-password"];
    self.passWordTextField.leftView = passwordLeft;
    self.passWordTextField.leftViewMode = UITextFieldViewModeAlways;
    [self addSubview:self.passWordTextField];
    
    
    
    self.loginButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.loginButton.frame = CGRectMake(kScreenWidth*0.25, (kScreenHeight - 64)*0.6, kScreenWidth*0.5, (kScreenHeight - 64)*0.08);
//    self.registerButton.backgroundColor = [UIColor redColor];
    [self.loginButton setTitle:@"开始寻觅" forState:UIControlStateNormal];
    [self.loginButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    self.loginButton.titleLabel.font = [UIFont boldSystemFontOfSize:self.buttonBigFont];
    [self addSubview:self.loginButton];
    
    
    self.findPasswordButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.findPasswordButton.frame = CGRectMake(CGRectGetMinX(self.loginButton.frame), CGRectGetMaxY(self.loginButton.frame)+(kScreenHeight - 64)*0.03, kScreenWidth*0.5, (kScreenHeight - 64)*0.06);
//    self.findPasswordButton.backgroundColor = [UIColor redColor];
    [self.findPasswordButton setTitle:@"找回密码" forState:UIControlStateNormal];
    [self.findPasswordButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    self.findPasswordButton.titleLabel.font = [UIFont boldSystemFontOfSize:self.buttonFont];
    [self addSubview:self.findPasswordButton];
    
    
    self.registerButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.registerButton.frame = CGRectMake(CGRectGetMinX(self.findPasswordButton.frame), CGRectGetMaxY(self.findPasswordButton.frame)+(kScreenHeight - 64)*0.03, CGRectGetWidth(self.findPasswordButton.frame), (kScreenHeight - 64)*0.06);
//    self.loginButton.backgroundColor = [UIColor redColor];
    [self.registerButton setTitle:@"加入寻觅" forState:UIControlStateNormal];
    [self.registerButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    self.registerButton.titleLabel.font = [UIFont boldSystemFontOfSize:self.buttonFont];
    [self addSubview:self.registerButton];
    
}









@end
